package com.loser.room.controller;

import com.loser.module.base.common.APiResponsePage;
import com.loser.module.base.common.ApiResponse;
import com.loser.room.mongo.handler.RoomHandler;
import com.loser.rpc.room.dto.req.RoomPageReq;
import com.loser.rpc.room.dto.req.RoomSaveReq;
import com.loser.rpc.room.dto.req.RoomUpdateReq;
import com.loser.rpc.room.dto.resp.RoomInfoResp;
import com.loser.rpc.room.fallback.RoomFeignFallBack;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RestController;

/**
 * 测试数据 接口
 *
 * @author loser
 * @date 2023-02-05  14:01
 */
@RestController
public class RoomController extends RoomFeignFallBack {

    @Autowired
    private RoomHandler roomHandler;

    @Override
    public ApiResponse<Boolean> save(RoomSaveReq req) {
        return roomHandler.save(req);
    }

    @Override
    public ApiResponse<Boolean> update(RoomUpdateReq req) {
        return roomHandler.update(req);
    }

    @Override
    public ApiResponse<Boolean> deleteById(Long id) {
        return roomHandler.deleteById(id);
    }

    @Override
    public ApiResponse<RoomInfoResp> getById(Long id) {
        return roomHandler.getById(id);
    }

    @Override
    public APiResponsePage<RoomInfoResp, Object> queryList(RoomPageReq req) {
        return roomHandler.queryList(req);
    }

}
